package com.fenxiangle.yueding.feature.home.view.adapter;

import android.text.TextUtils;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fenxiangle.yueding.R;
import com.fenxiangle.yueding.entity.bo.HomeDataBo;
import com.fenxiangle.yueding.framework.DataServer;
import com.suozhang.framework.framework.AM;

public class HomeAdapter extends BaseQuickAdapter<HomeDataBo, BaseViewHolder> {
    public HomeAdapter() {
        super(R.layout.item_home);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeDataBo item) {
        helper.addOnClickListener(R.id.iv_show_foucs)
                .addOnClickListener(R.id.btn_home_focus)
                .addOnClickListener(R.id.iv_home_head)
                .setText(R.id.tv_home_xyf,"信用分："+item.getCreditScore())
                .setText(R.id.tv_home_sjz,"时间值："+item.getTimeValue())
                .setText(R.id.tv_home_fans,"粉丝（"+item.getFans()+")")
                .setText(R.id.tv_title, item.getUserVideoFormMap() != null && !TextUtils.isEmpty(item.getUserVideoFormMap().getVideoDescribe()) ? item.getUserVideoFormMap().getVideoDescribe() : "")
                .setText(R.id.btn_home_focus, "邀约");


        AM.image().bindToCircleObject(item.getUserHead(), helper.getView(R.id.iv_home_head));
        AM.image().bind(!TextUtils.isEmpty(item.getUserVideoFormMap().getVideoCover())&&!TextUtils.isEmpty(item.getUserVideoFormMap().getVideoUrl()) ? item.getUserVideoFormMap().getVideoCover() : item.getUserImagesFormMap().getImage(), helper.getView(R.id.iv_vedio_thumb));
    }
}
